﻿using STHPMS1.BLL.B_Core;
using STHPMS1.ICore.I_BLL.Bus;
using STHPMS1.ICore.I_Entity.Info;
using STHPMS1.ICore.I_Entity.Stmpms1;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using STHPMS1.Common.C_Entity.Stmpms1;

namespace STHPMS1.BLL.B_Bus
{
    public class Dp_Preven_MeaintBus : BllBase, IDp_Preven_MeaintBill
    {
        public void Save<T>(T entity)
            where T : class ,IDp_Preven_Meaint
        {
            if (this.Scene.Dal.Sthpms1.Update(entity) == 0)
            {
                this.Scene.Dal.Sthpms1.Insert(entity);
            }
        }

        public void Remove(IDp_Preven_Meaint entity)
        {
            this.Scene.Dal.Sthpms1.Delete(entity);
        }

        public IEnumerable<T> Get<T>(Expression<Func<T, bool>> predicate, IPagingInfo info)
            where T : class, IDp_Preven_Meaint
        {
            return this.Scene.Dal.Sthpms1.Select<T>(predicate, info);
        }

        /// <summary>
        /// 获取初选措施信息 预防性养护措施初选表 筛选适合的措施
        /// </summary>
        /// <param name="str1"></param>
        /// <param name="str2"></param>
        /// <param name="str3"></param>
        /// <param name="rdclass"></param>
        /// <returns></returns>
        public List<T> Get<T>(string str1, string str2, string str3, int rdclass) where T : class, IDp_Preven_Meaint
        {
            return this.Scene.Dal.Sthpms1.Dp_Preven_Meaint.Get<T>(str1, str2, str3, rdclass);
        }

        /// <summary>
        /// 获取初选措施信息 预防性养护措施初选表 筛选适合的措施
        /// </summary>
        /// <param name="str1"></param>
        /// <param name="str2"></param>
        /// <param name="str3"></param>
        /// <param name="rdclass"></param>
        /// <returns></returns>
        public List<T> Get<T>(string Strsearch, int rdclass) where T : class, IDp_Preven_Meaint
        {
            return this.Scene.Dal.Sthpms1.Dp_Preven_Meaint.Get<T>(Strsearch, rdclass);
        }

    }
}
